package com.sunnay.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.sunnay.entity.UserBidEntity;
import com.sunnay.mapper.UserBidMapper;
import com.sunnay.service.UserBidService;
import com.sunnay.vo.auth.SystemUser;
import com.sunnay.vo.common.Page;
import com.sunnay.vo.small.SmallQueryVo;
import com.sunnay.vo.small.SmallRequestVo;
import com.sunnay.vo.small.SmallResponseVo;
import org.springframework.stereotype.Service;

import java.util.Collections;
import java.util.List;

@Service
public class UserBidServiceImpl extends ServiceImpl<UserBidMapper, UserBidEntity> implements UserBidService {
    @Override
    public List<UserBidEntity> smallList() {
        return this.baseMapper.smallList();
    }

    @Override
    public List<SmallResponseVo> smallList(SystemUser user, Page page, SmallQueryVo queryVo) {
        return this.baseMapper.smallLists(Long.parseLong(user.getId()),page,queryVo);
    }

    @Override
    public void addSmall(SystemUser systemUser, SmallRequestVo requestVo) {
        UserBidEntity userBidEntity = new UserBidEntity();
        userBidEntity.setUt(requestVo.getUt().replaceAll("ut=",""));
        userBidEntity.setMark(requestVo.getMark());
        userBidEntity.setProcess("1000");
        userBidEntity.setUserAccountId(Long.parseLong(systemUser.getId()));
        this.save(userBidEntity);
    }
}
